package com.demospringboot.utils;

/**
 * 密码生成器 - 用于生成学生密码的MD5+盐值加密结果
 * 运行此代码可以生成正确的加密密码用于SQL插入
 */
public class PasswordGenerator {
    
    public static void main(String[] args) {
        // 学生密码
        String studentPassword = "student123";
        
        System.out.println("=== 学生密码加密结果 ===");
        System.out.println("原始密码: " + studentPassword);
        System.out.println("加密结果: " + PasswordUtils.md5AndSalt(studentPassword));
        
        // 验证密码是否正确
        String encryptedPassword = PasswordUtils.md5AndSalt(studentPassword);
        boolean isMatch = PasswordUtils.match(studentPassword, encryptedPassword);
        System.out.println("密码验证: " + (isMatch ? "正确" : "错误"));
        
        System.out.println("\n=== 生成多个不同的加密密码 ===");
        for (int i = 1; i <= 5; i++) {
            String encrypted = PasswordUtils.md5AndSalt(studentPassword);
            System.out.println("学生" + i + "加密密码: " + encrypted);
        }
        
        System.out.println("\n=== SQL插入语句示例 ===");
        System.out.println("INSERT INTO sys_user (username, password, name, role, dormitory_number, create_time, update_time)");
        System.out.println("VALUES ('2021001', '" + PasswordUtils.md5AndSalt(studentPassword) + "', '张三', 'STUDENT', '1号楼101室', NOW(), NOW());");
    }
} 